/**
 * Created by sunhao on 2016/4/18.
 */

//加载图片
var largeImage = $('.largeImage'), part3Image = $('.part3'), addressImage = $('.address');
var largeImageUrl = $('#largeImage').val(), part3ImageUrl = $('#part3Image').val(), addressImageUrl = $('#addressImage').val();
function addImage(obj,url){
    $(obj).attr('style', 'background:url("' + url + '") no-repeat center center');
}
$(document).ready(function () {
    addImage(largeImage,largeImageUrl);
    addImage(part3Image,part3ImageUrl);
    addImage(addressImage,addressImageUrl);

    $('.news ul li p ').hover(function(){
        console.log($(this).parent().prev())
        if($(this).parent().prev().attr('class') == 'span-news'){
            $(this).attr('style','color:#46abfe')
        }else{
            $(this).attr('style','color:#f16712')
        }
    },function(){
        $(this).attr('style','color:#ffffff')
    })
});


//开幕倒计时
function timer() {
    var EndTime = new Date('2016/05/15 00:00:00');
    var NowTime = new Date();
    var t = EndTime.getTime() - NowTime.getTime();
    var d = Math.floor(t / 1000 / 60 / 60 / 24);
    var h = Math.floor(t / 1000 / 60 / 60 % 24);
    var m = Math.floor(t / 1000 / 60 % 60);
    var s = Math.floor(t / 1000 % 60);

    d = checkTime(d);
    h = checkTime(h);
    m = checkTime(m);
    s = checkTime(s);
    document.getElementById("dd").innerHTML = d;
    document.getElementById("hh").innerHTML = h;
    document.getElementById("mm").innerHTML = m;
    document.getElementById("ss").innerHTML = s;

}
setInterval(timer, 1000);

function checkTime(i) {
    if (i < 10) {
        i = "0" + i;
    }
    return i;
}

//显示隐藏信息
$('ul.line-contact li').hover(function(){
    $(this).children('div.contactInfo1-show').hide()
    $(this).children('div.contactInfo1-hide').show()
    $(this).children('div.contactInfo2-hide').show()
},function(){
    $(this).children('div.contactInfo1-show').show()
    $(this).children('div.contactInfo1-hide').hide()
    $(this).children('div.contactInfo2-hide').hide()
})
